package a.f.h.b;

import a.c.d;
import a.c.e;
import a.c.*;
import a.f.j.cb;
import a.f.j.p;
import a.f.wc;

import java.util.ArrayList;

public class f
{
  private z a;
  private static final int b = 0;
  private static final int c = 1;
  private static final int e = 2;
  private static double f = 0.001D;
  private a.f.j.ab g;
  private cb h;
  private a.c.n i;
  private x j;
  private boolean k;
  public static boolean l;
  public static int m;
  
  public f(q paramq)
  {
    this(new a.f.j.ab(paramq));
    this.k = true;
  }
  
  public f(a.f.j.ab paramab)
  {
    this.g = paramab;
    if (n == 0)
    {
      if ((this.g instanceof cb))
      {
        this.h = ((cb)this.g);
        if (n != 0) {
          return;
        }
        if (!l) {}
      }
      else
      {
        this.h = null;
      }
    }
    else {
      this.j = a().B();
    }
    this.a = new z();
    this.i = a().C();
  }
  
  public f(cb paramcb)
  {
    this(paramcb);
  }
  
  public q a()
  {
    return this.g.a();
  }
  
  public a.f.j.ab b()
  {
    return this.g;
  }
  
  public d a(d paramd)
  {
    return this.g.b(paramd);
  }
  
  public void a(d paramd1, d paramd2)
  {
    this.g.a(paramd1, paramd2);
  }
  
  public a.f.j.o c()
  {
    return this.g.b();
  }
  
  public void a(a.f.j.n paramn)
  {
    this.g.a(paramn);
  }
  
  public a.f.j.n d()
  {
    return this.g.c();
  }
  
  public int e()
  {
    return this.g.d();
  }
  
  public a.f.j.n b(d paramd)
  {
    return this.g.c(paramd);
  }
  
  public void f()
  {
    this.g.e();
  }
  
  public void g()
  {
    this.g.f();
  }
  
  public p h()
  {
    return this.g.g();
  }
  
  public void a(p paramp)
  {
    this.g.a(paramp);
  }
  
  public boolean i()
  {
    return this.g.h();
  }
  
  public void c(d paramd)
  {
    this.g.g(paramd);
  }
  
  public boolean d(d paramd)
  {
    return this.g.h(paramd);
  }
  
  protected void a(e parame, int paramInt)
  {
    int n = m;
    if (n == 0) {
      if (this.h == null)
      {
        if (n != 0) {
          break label35;
        }
        m(parame).a(paramInt);
        if (!l) {
          return;
        }
      }
    }
    label35:
    this.h.a(parame, paramInt);
  }
  
  protected int a(e parame)
  {
    if (m == 0) {
      if (this.h == null) {
        return m(parame).a();
      }
    }
    return this.h.a(parame);
  }
  
  public void j()
  {
    int n = m;
    boolean bool = l;
    if (n == 0) {
      if (!(this.g instanceof cb)) {
        return;
      }
    }
    cb localcb = (cb)this.g;
    a.c.w localw = a().v();
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      if (n == 0) {
        if (localcb.f(locale)) {
          f(locale);
        }
      }
      if (n == 0) {
        if (localcb.b(locale)) {
          c(locale);
        }
      }
      if (n == 0)
      {
        if (localcb.e(locale)) {
          g(locale);
        }
        localw.f();
      }
    } while (!bool);
  }
  
  public boolean b(e parame)
  {
    if (m == 0) {}
    return a(parame) == 1;
  }
  
  public void c(e parame)
  {
    a(parame, 1);
  }
  
  public boolean d(e parame)
  {
    if (m == 0) {}
    return a(parame) == 0;
  }
  
  public void f(e parame)
  {
    a(parame, 0);
  }
  
  public int k()
  {
    int i1 = m;
    boolean bool = l;
    int n = 0;
    do
    {
      a.c.w localw = a().v();
      while (!bool)
      {
        if (!localw.e()) {
          break;
        }
        if (bool) {
          break label64;
        }
        if (b(localw.d())) {
          n++;
        }
        localw.f();
      }
    } while (i1 != 0);
    label64:
    return n;
  }
  
  public void g(e parame)
  {
    a(parame, 2);
  }
  
  public boolean h(e parame)
  {
    if (m == 0) {}
    return a(parame) == 2;
  }
  
  public boolean i(e parame)
  {
    int n = m;
    if (n == 0) {
      if (!h(parame)) {
        if (n != 0) {
          break label29;
        }
      }
    }
    label29:
    return b(parame);
  }
  
  public void a(d paramd, int paramInt)
  {
    r(paramd).a(paramInt);
  }
  
  public void a(d paramd, double paramDouble)
  {
    r(paramd).a((int)Math.floor(paramDouble + f));
  }
  
  public int e(d paramd)
  {
    return r(paramd).e();
  }
  
  public String f(d paramd)
  {
    return r(paramd).f();
  }
  
  public void a(d paramd, String paramString)
  {
    r(paramd).a(paramString);
  }
  
  public void a(d paramd, char paramChar)
  {
    char[] arrayOfChar = { paramChar };
    r(paramd).a(new String(arrayOfChar));
  }
  
  public void a(d paramd, k paramk)
  {
    r(paramd).a(paramk.toString());
  }
  
  public void g(d paramd)
  {
    int n = m;
    d locald = a(paramd);
    String str = f(paramd);
    if (n == 0)
    {
      if (str == null)
      {
        if (n != 0) {
          break label52;
        }
        a(locald, (String)null);
      }
    }
    else if (!l) {
      return;
    }
    label52:
    a(locald, a(str));
  }
  
  public static String a(String paramString)
  {
    int i1 = m;
    boolean bool = l;
    StringBuffer localStringBuffer = new StringBuffer();
    int n = paramString.length() - 1;
    do
    {
      if (n < 0) {
        break;
      }
      if (i1 != 0) {
        break label74;
      }
      k localk = k.a(paramString.charAt(n));
      localk = localk.d();
      if (bool) {
        break label71;
      }
      localStringBuffer.append(localk.toString());
      n--;
    } while (!bool);
    label71:
    label74:
    return localStringBuffer.toString();
  }
  
  public void a(a.c.n paramn, d paramd, k paramk)
  {
    int i3 = m;
    boolean bool = l;
    boolean[] arrayOfBoolean = new boolean[e()];
    d[] arrayOfd = new d[e()];
    p localp = h();
    int n = 0;
    a.f.j.o localo = c();
    do
    {
      do
      {
        if (!localo.e()) {
          break;
        }
        localObject = localo.a();
        localp.a((a.f.j.n)localObject, n);
        arrayOfd[n] = null;
        arrayOfBoolean[n] = false;
        n++;
        localo.f();
        if ((i3 == 0) && (bool)) {
          break label120;
        }
      } while (!bool);
    } while (i3 != 0);
    localo = c();
    label120:
    Object localObject = a(paramd);
    a.f.j.n localn2 = b((d)localObject);
    a(a((d)localObject), paramk.toString());
    arrayOfd[localp.getInt(localn2)] = localObject;
    int i1 = 0;
    a.f.j.n localn1 = localn2;
    if (i1 < e())
    {
      if (bool) {
        return;
      }
      if (i3 == 0)
      {
        if (arrayOfBoolean[localp.getInt(localn1)] == 0)
        {
          if (i3 != 0) {
            break label278;
          }
          if (arrayOfd[localp.getInt(localn1)] != null) {}
        }
        else
        {
          localo.f();
        }
      }
      else if (i3 == 0) {
        if (localo.e()) {}
      }
    }
    label278:
    label372:
    while (i3 != 0)
    {
      do
      {
        localo = c();
        localn1 = localo.a();
      } while (!bool);
      d locald = arrayOfd[localp.getInt(localn1)];
      k localk1 = k.a(f(a(locald)).charAt(0));
      localk1 = localk1.d();
      m localm = localn1.a();
      do
      {
        do
        {
          if (localm.a() == locald) {
            break;
          }
          localm.f();
          if ((i3 == 0) && (bool)) {
            break label372;
          }
        } while (!bool);
      } while (i3 != 0);
      localObject = locald;
      break label592;
      localm.b();
      locald = localm.a();
      k localk2 = localk1;
      localk2 = localk2.d();
      localk2 = localk2.b(e(locald));
      String str1 = (String)paramn.get(locald);
      String str2 = null;
      if (i3 == 0) {
        if (str1.length() > 0)
        {
          StringBuffer localStringBuffer = new StringBuffer(localk2.toString());
          int i2 = 0;
          do
          {
            do
            {
              while (bool) {
                if (i2 >= str1.length()) {
                  break;
                }
              }
              if (str1.charAt(i2) == '<') {
                localk2 = localk2.b();
              }
              if (i3 == 0)
              {
                if (str1.charAt(i2) == '>') {
                  localk2 = localk2.a();
                }
                localStringBuffer.append(localk2.toString());
                i2++;
              }
            } while (!bool);
          } while (i3 != 0);
          str2 = localStringBuffer.toString();
          break label541;
        }
      }
      str2 = localk2.toString();
      a(locald, str2);
      arrayOfd[localp.getInt(b(a(locald)))] = a(locald);
      do
      {
        do
        {
          localk1 = k.a(str2.charAt(str2.length() - 1));
          if (locald != localObject) {
            break;
          }
          arrayOfBoolean[localp.getInt(localn1)] = true;
          i1++;
        } while (i3 != 0);
        if (bool) {
          break;
        }
      } while (i3 != 0);
      if (!bool) {
        break;
      }
    }
    label541:
    label592:
    a(localp);
  }
  
  public int[] k(e parame)
  {
    int n = m;
    boolean bool = l;
    int[] arrayOfInt = { 0, 0, 0, 0 };
    m localm = parame.n();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      k localk = k.a(f(locald).charAt(0));
      if ((n == 0) && (bool)) {
        break label100;
      }
      arrayOfInt[localk.g()] += 1;
      localm.f();
    } while (!bool);
    label100:
    return arrayOfInt;
  }
  
  public int[][] l(e parame)
  {
    int n = m;
    boolean bool = l;
    int[][] arrayOfInt = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    m localm = parame.n();
    label191:
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      k localk = k.a(f(locald).charAt(0));
      if (n == 0)
      {
        if (!d(locald.f()))
        {
          if (n != 0) {
            break label191;
          }
          if (!b(locald.f())) {}
        }
        else
        {
          arrayOfInt[localk.g()][1] += 1;
        }
      }
      else
      {
        if (n != 0) {
          continue;
        }
        if (!bool) {
          break label288;
        }
      }
      if (n == 0)
      {
        if (e(a(locald)) == 1)
        {
          arrayOfInt[localk.g()][0] += 1;
          if (n != 0) {
            continue;
          }
          if (!bool) {
            break label288;
          }
        }
        if (n != 0) {}
      }
      else
      {
        if (e(a(locald)) != 3) {
          break label265;
        }
        arrayOfInt[localk.g()][2] += 1;
      }
      if (n == 0)
      {
        if (bool) {
          a.i.n.a("Cannot classify edge : " + locald);
        }
        localm.f();
      }
    } while (!bool);
    label265:
    label288:
    return arrayOfInt;
  }
  
  public int h(d paramd)
  {
    k localk = k.a(f(paramd).charAt(0));
    return localk.g();
  }
  
  public k i(d paramd)
  {
    return k.a(f(paramd).charAt(0));
  }
  
  public int j(d paramd)
  {
    b_ localb_ = r(paramd);
    return localb_.g();
  }
  
  public boolean k(d paramd)
  {
    b_ localb_ = r(paramd);
    if (m == 0) {}
    return localb_.g() != -2147483648;
  }
  
  public void c(d paramd, int paramInt)
  {
    b_ localb_ = r(paramd);
    localb_.b(paramInt);
  }
  
  public double l(d paramd)
  {
    b_ localb_ = r(paramd);
    return localb_.h();
  }
  
  public void c(d paramd, double paramDouble)
  {
    b_ localb_ = r(paramd);
    localb_.a(paramDouble);
  }
  
  public void e(d paramd, int paramInt)
  {
    r(paramd).l = paramInt;
  }
  
  public void f(d paramd, int paramInt)
  {
    r(paramd).m = paramInt;
  }
  
  public int m(d paramd)
  {
    return r(paramd).l;
  }
  
  public int n(d paramd)
  {
    return r(paramd).m;
  }
  
  public void a(j paramj)
  {
    this.a.add(paramj);
  }
  
  public a.c.y l()
  {
    return this.a.h();
  }
  
  public a.c.ab g(d paramd, int paramInt)
  {
    int i2 = m;
    boolean bool = l;
    cb localcb = (cb)b();
    if (i2 == 0) {
      if (f(paramd).length() != 1) {
        throw new RuntimeException("Shape not simple: " + f(paramd));
      }
    }
    k localk1 = i(paramd);
    k localk2 = localk1.d();
    int n = e(paramd);
    int i1 = e(a(paramd));
    a.c.ab localab = localcb.a(paramd, paramInt);
    m localm = localab.l();
    label199:
    label202:
    label236:
    label239:
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      a(locald, localk1);
      if (i2 == 0)
      {
        a(a(locald), localk2);
        if (locald.f() != paramd.f())
        {
          if (i2 != 0) {
            break label199;
          }
          a(a(locald), 2);
          if (!bool) {
            break label202;
          }
        }
      }
      a(a(locald), i1);
      if (locald.e() != paramd.e())
      {
        if (i2 != 0) {
          break label236;
        }
        a(locald, 2);
        if (!bool) {
          break label239;
        }
      }
      a(locald, n);
      if (locald.f() != paramd.f()) {
        f(locald.f());
      }
      localm.f();
    } while (!bool);
    return localab;
  }
  
  public void o(d paramd)
  {
    int i3 = m;
    boolean bool = l;
    if (i3 == 0) {
      if (this.g.h(paramd)) {
        throw new IllegalArgumentException("Edge: " + paramd + " is inserted !");
      }
    }
    String str1 = f(paramd);
    if (str1.length() == 1) {
      return;
    }
    d locald1 = a(paramd);
    String str2 = f(locald1);
    cb localcb = (cb)b();
    a.c.ab localab = localcb.a(paramd, str1.length() - 1);
    int n = 0;
    m localm = localab.l();
    label231:
    label233:
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald2 = localm.a();
      d locald3 = a(locald2);
      e locale = locald2.f();
      if (i3 == 0) {
        if (n == 0)
        {
          a(locald2, e(paramd));
          if (i3 != 0) {
            break label233;
          }
          if (!bool) {
            break label231;
          }
        }
      }
      int i1 = k.a(str1.charAt(n - 1)).g();
      int i2 = k.a(str1.charAt(n)).g();
      a(locald2, k.a(i1 - i2).g());
      if (i3 == 0) {
        if (n == str1.length() - 1)
        {
          a(locald3, e(locald1));
          if (i3 != 0) {
            break label350;
          }
          if (!bool) {
            break label344;
          }
        }
      }
      i1 = k.a(str2.charAt(str2.length() - n - 2)).g();
      i2 = k.a(str2.charAt(str2.length() - n - 1)).g();
      a(locald3, k.a(i1 - i2).g());
      g(locale);
      localcb.d(locale);
      if (i3 == 0)
      {
        if (str1.charAt(n) != '+') {
          a(locald2, str1.charAt(n));
        }
        if (i3 != 0) {}
      }
      else
      {
        if (str2.charAt(str2.length() - n - 1) != '+') {
          a(locald3, str2.charAt(str2.length() - n - 1));
        }
        n++;
        localm.f();
      }
    } while (!bool);
    label344:
    label350:
    return;
  }
  
  public void m()
  {
    int i2 = m;
    boolean bool = l;
    q localq = a();
    cb localcb = (cb)b();
    a.c.w localw = localq.v();
    label437:
    label604:
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      if ((i2 == 0) && (bool)) {
        return;
      }
      if (i2 == 0)
      {
        if (h(locale))
        {
          m localm = locale.n();
          d locald1 = localm.a();
          localm.f();
          d locald2 = localm.a();
          if (i2 != 0) {
            continue;
          }
          if (i(locald1).d().c(i(locald2)))
          {
            d locald3 = localcb.b(locald1);
            d locald4 = localcb.b(locald2);
            String str = f(locald3);
            str = str + f(locald2).substring(1);
            double d1 = e(locald3);
            double d2 = e(locald4);
            int n = localcb.c(locald1) == localcb.c() ? 1 : 0;
            int i1 = localcb.c(locald3) == localcb.c() ? 1 : 0;
            d locald5 = localcb.h(locale);
            d locald6 = localcb.b(locald5);
            a.f.o localo;
            if (i2 == 0) {
              if (locald5.e() == locald3.e())
              {
                if (i2 != 0) {
                  break label437;
                }
                if (locald5.f() == locald2.f())
                {
                  a(locald5, str);
                  g(locald5);
                  a(locald5, d1);
                  a(locald6, d2);
                  if (i2 == 0) {
                    if (i1 != 0) {
                      localcb.a(localcb.c(locald5));
                    }
                  }
                  if (i2 == 0) {
                    if (n != 0) {
                      localcb.a(localcb.c(locald6));
                    }
                  }
                  if (i2 != 0) {
                    continue;
                  }
                  if (!(localq instanceof a.f.o)) {
                    break label604;
                  }
                  localo = (a.f.o)localq;
                  localo.c(locald5, localo.r(locald3));
                  localo.d(locald5, localo.s(locald2));
                  localo.b(locald5, a.d.y.a);
                  if (i2 != 0) {
                    continue;
                  }
                  if (!bool) {
                    break label604;
                  }
                }
              }
            }
            if ((i2 != 0) || ((locald5.e() == locald4.e()) && (locald5.f() == locald1.f())))
            {
              a(locald6, str);
              g(locald6);
              a(locald5, d2);
              a(locald6, d1);
              if (i2 == 0) {
                if (n != 0) {
                  localcb.a(localcb.c(locald5));
                }
              }
              if (i2 == 0) {
                if (i1 != 0) {
                  localcb.a(localcb.c(locald6));
                }
              }
              if (i2 != 0) {
                continue;
              }
              if ((localq instanceof a.f.o))
              {
                localo = (a.f.o)localq;
                localo.c(locald5, localo.r(locald4));
                localo.d(locald5, localo.s(locald1));
                localo.b(locald5, a.d.y.a);
                if (i2 != 0) {
                  continue;
                }
                if (!bool) {}
              }
            }
            else
            {
              throw new RuntimeException("Error in remove 180 degree bends");
            }
          }
        }
        localw.f();
      }
    } while (!bool);
    if (i2 == 0) {
      localcb.e();
    }
  }
  
  public void n()
  {
    int n = m;
    boolean bool = l;
    a.f.o localo = (a.f.o)a();
    cb localcb = (cb)b();
    a.c.w localw = localo.v();
    label275:
    label348:
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      if ((n == 0) && (bool)) {
        return;
      }
      if (n == 0)
      {
        if (h(locale))
        {
          m localm = locale.n();
          d locald1 = localm.a();
          localm.f();
          d locald2 = localm.a();
          d locald3 = localcb.b(locald1);
          d locald4 = localcb.b(locald2);
          a.d.w localw1 = localo.r(locald3);
          a.d.w localw2 = localo.s(locald2);
          a.d.w localw3 = localo.o(locale);
          z localz = localo.m(locald3);
          localz.add(localw3);
          localz.a(localo.m(locald2));
          d locald5 = localcb.h(locale);
          d locald6 = localcb.b(locald5);
          if (n == 0) {
            if (locald5.e() == locald3.e())
            {
              if (n != 0) {
                break label275;
              }
              if (locald5.f() == locald2.f())
              {
                localo.c(locald5, localw1);
                localo.d(locald5, localw2);
                localo.b(locald5, localz);
                wc.a(localo, locald6, locald5);
                if (n != 0) {
                  continue;
                }
                if (!bool) {
                  break label348;
                }
              }
            }
          }
          if ((n != 0) || ((locald5.e() == locald4.e()) && (locald5.f() == locald1.f())))
          {
            localo.c(locald6, localw1);
            localo.d(locald6, localw2);
            localo.b(locald6, localz);
            wc.a(localo, locald5, locald6);
            if (n != 0) {
              continue;
            }
            if (!bool) {}
          }
          else
          {
            throw new RuntimeException("Error in remove bend");
          }
        }
        localw.f();
      }
    } while (!bool);
    if (n == 0) {
      localcb.e();
    }
  }
  
  public void o()
  {
    int i6 = m;
    boolean bool = l;
    a.i.n.a(this, "Check if all necessary data is set..");
    Object localObject1 = a().w();
    Object localObject2;
    do
    {
      do
      {
        if (!((m)localObject1).e()) {
          break;
        }
        localObject2 = ((m)localObject1).a();
        if (bool) {
          break label178;
        }
        if (f((d)localObject2) == null) {
          throw new RuntimeException("Null shape !");
        }
        if (i6 == 0) {
          if (f((d)localObject2).length() == 0) {
            throw new RuntimeException("Empty shape !");
          }
        }
        if ((i6 != 0) || (e((d)localObject2) >= 0))
        {
          if (i6 != 0) {
            continue;
          }
          if (e((d)localObject2) <= 4) {}
        }
        else
        {
          throw new RuntimeException("Angle out of bounds !");
        }
        ((m)localObject1).f();
      } while (!bool);
      a.i.n.a(this, 0, "Check if reverse directions are compatible..");
    } while (i6 != 0);
    localObject1 = a().w();
    label178:
    Object localObject4;
    do
    {
      if (!((m)localObject1).e()) {
        break;
      }
      localObject2 = ((m)localObject1).a();
      String str = f((d)localObject2);
      localObject4 = a(str);
      if ((i6 == 0) && (bool)) {
        break label267;
      }
      if (i6 == 0)
      {
        if (!((String)localObject4).equals(a(str))) {
          throw new RuntimeException("Shapes are not compatible for " + localObject2 + " !");
        }
        ((m)localObject1).f();
      }
    } while (!bool);
    if (i6 == 0) {
      a.i.n.a(this, 0, "Check if sum of angles around a node is four..");
    }
    label267:
    localObject1 = a().v();
    label416:
    label418:
    do
    {
      do
      {
        if (!((a.c.w)localObject1).e()) {
          break;
        }
        localObject2 = ((a.c.w)localObject1).d();
        int i1 = 0;
        if (bool) {
          break label447;
        }
        if (((e)localObject2).e() == 0) {
          i1 = 4;
        }
        localObject4 = ((e)localObject2).n();
        if (((m)localObject4).e()) {}
        while (i6 != 0)
        {
          i1 += e(((m)localObject4).a());
          ((m)localObject4).f();
          if (i6 != 0) {
            break label418;
          }
          if (bool) {
            break label416;
          }
          if (!bool) {
            break;
          }
        }
        if (i1 != 4) {
          throw new RuntimeException("Node [" + localObject2 + "] has anglesum != 4 (" + i1 + ") !");
        }
        ((a.c.w)localObject1).f();
      } while (!bool);
      a.i.n.a(this, 0, "Check if angles are compatible with shape..");
    } while (i6 != 0);
    localObject1 = a().v();
    label447:
    do
    {
      if (!((a.c.w)localObject1).e()) {
        break;
      }
      localObject2 = ((a.c.w)localObject1).d();
      if (bool) {
        break label690;
      }
      localObject3 = ((e)localObject2).n();
      do
      {
        do
        {
          if (!((m)localObject3).e()) {
            break label662;
          }
          localObject4 = ((m)localObject3).a();
          d locald = this.g.d((d)localObject4);
          int i2 = h((d)localObject4);
          int i3 = h(locald);
          int i4 = e(locald);
          int i5 = (i3 - i2) % 4;
          if (bool) {
            break;
          }
          if (i5 < 0) {
            i5 += 4;
          }
          if (i6 == 0)
          {
            if (i5 != i4 % 4) {
              throw new RuntimeException("Angle <-> shape inconsistency ( " + localObject4 + "[" + f((d)localObject4) + "],  " + locald + "[" + f(locald) + "], angle field " + i4 + ", shape: " + i5 + " )" + " !");
            }
            ((m)localObject3).f();
          }
        } while (!bool);
        ((a.c.w)localObject1).f();
      } while (i6 != 0);
    } while (!bool);
    label662:
    if (i6 == 0) {
      a.i.n.a(this, 0, "Check if outer face is set correctly..");
    }
    label690:
    if (i6 == 0) {
      if (d() == null) {
        throw new RuntimeException("No outer face defined !");
      }
    }
    localObject1 = d();
    int n = 0;
    Object localObject3 = c();
    do
    {
      do
      {
        if (!((a.f.j.o)localObject3).e()) {
          break;
        }
        localObject4 = ((a.f.j.o)localObject3).a();
        if (bool) {
          return;
        }
        if (localObject1 == localObject4) {
          n = 1;
        }
        ((a.f.j.o)localObject3).f();
      } while (!bool);
    } while (i6 != 0);
    if (n == 0) {
      throw new RuntimeException("Non existing face set to outer face : " + localObject1);
    }
  }
  
  public void p()
  {
    int i1 = m;
    boolean bool = l;
    a.c.w localw = a().v();
    label163:
    label332:
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale1 = localw.d();
      a.i.n.a("node: " + locale1 + " index: " + locale1.f());
      String str = "";
      d locald1 = null;
      d locald2 = null;
      m localm1 = null;
      if (i1 == 0) {
        if (locald2 != null)
        {
          str = str + "starting with firstOutgoing :";
          localm1 = locale1.b(locald2);
          break label163;
        }
      }
      if (locald1 != null)
      {
        str = str + "starting with firstIncoming :";
        localm1 = locale1.b(locald1);
      }
      else
      {
        localm1 = locale1.n();
      }
      int n = 0;
      do
      {
        do
        {
          if (n >= localm1.k()) {
            break label332;
          }
          d locald3 = localm1.a();
          str = str + f(locald3);
          e locale2 = locald3.a(locale1);
          if (bool) {
            break;
          }
          if (h(locale2))
          {
            m localm2 = locale2.n();
            if ((i1 != 0) || (localm2.a() == a(locald3))) {
              localm2.b();
            }
            str = str + f(localm2.a());
          }
          str = str + " , ";
          localm1.b();
          n++;
        } while (!bool);
        a.i.n.a("\t" + str);
        localw.f();
      } while (i1 != 0);
    } while (!bool);
  }
  
  public void q()
  {
    int n = m;
    boolean bool = l;
    m localm = a().w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (n == 0) {
        if (f(locald) == null) {
          throw new RuntimeException("Null shape !");
        }
      }
      if (n == 0)
      {
        if (f(locald).length() != 1) {
          throw new RuntimeException("non-simple shape !");
        }
        localm.f();
      }
    } while (!bool);
  }
  
  public void r()
  {
    int i2 = m;
    boolean bool = l;
    q();
    a.f.j.o localo = c();
    label178:
    do
    {
      if (!localo.e()) {
        break;
      }
      a.f.j.n localn = localo.a();
      int n = 0;
      int i1 = 0;
      m localm = localn.a();
      do
      {
        if (!localm.e()) {
          break;
        }
        n += e(localm.a());
        i1++;
        localm.f();
        if ((i2 == 0) && (bool)) {
          break label178;
        }
      } while (!bool);
      if ((i2 == 0) && (i2 == 0)) {
        if ((d() != localn) && (n != 2 * i1 - 4)) {
          throw new RuntimeException("Inner Face ( " + localn + " ) has wrong angle sum (" + n + " != " + (2 * i1 - 4) + " ) !");
        }
      }
      if (d() == localn)
      {
        if (i2 != 0) {
          continue;
        }
        if (n != 2 * i1 + 4) {
          throw new RuntimeException("Outer Face ( " + localn + " ) has wrong angle sum (" + n + " != " + (2 * i1 + 4) + " ) !");
        }
      }
      localo.f();
    } while (!bool);
  }
  
  public void s()
  {
    if (!i()) {
      throw new RuntimeException("Graph is not planar !");
    }
  }
  
  protected boolean p(d paramd)
  {
    int i1 = m;
    d locald = this.g.d(this.g.b(paramd));
    int n = e(locald);
    if (i1 == 0) {
      if (n == 1) {
        return true;
      }
    }
    if ((i1 != 0) || (n == 3)) {
      return false;
    }
    throw new RuntimeException("Undefined Angle: " + n);
  }
  
  protected boolean q(d paramd)
  {
    int n = m;
    d locald = this.g.e(paramd);
    if (n == 0) {
      if (!d(paramd.e())) {
        return false;
      }
    }
    if (n == 0) {
      if (h(paramd.f()))
      {
        if (n != 0) {
          break label67;
        }
        if (h(locald.f())) {
          break label62;
        }
      }
    }
    return false;
    label62:
    label67:
    if (((n != 0) || (e(paramd) == 0)) && ((n != 0) || (p(locald)))) {
      if (n != 0) {}
    }
    return !p(paramd);
  }
  
  public boolean[] t()
  {
    int n = m;
    boolean bool = l;
    boolean[] arrayOfBoolean = new boolean[a().l()];
    Object localObject1 = a().v();
    Object localObject2;
    Object localObject3;
    Object localObject4;
    d locald1;
    d locald2;
    label212:
    label218:
    do
    {
      do
      {
        if (!((a.c.w)localObject1).e()) {
          break;
        }
        localObject2 = ((a.c.w)localObject1).d();
        if (bool) {
          break label326;
        }
        if (d((e)localObject2))
        {
          localObject3 = ((e)localObject2).n();
          do
          {
            if (!((m)localObject3).e()) {
              break label309;
            }
            localObject4 = ((m)localObject3).a();
            if (bool) {
              break;
            }
            if (h(((d)localObject4).f()))
            {
              locald1 = this.g.d((d)localObject4);
              locald2 = this.g.e((d)localObject4);
              if (n == 0) {
                if (e(locald1) == 0)
                {
                  if (n == 0) {
                    if (!h(locald1.f()))
                    {
                      arrayOfBoolean[localObject4.d()] = true;
                      if (n != 0) {
                        break label218;
                      }
                      if (!bool) {
                        break label212;
                      }
                    }
                  }
                  if (n != 0) {
                    break label218;
                  }
                  if (p(locald1))
                  {
                    if (n != 0) {
                      break label218;
                    }
                    if (p((d)localObject4)) {
                      arrayOfBoolean[localObject4.d()] = true;
                    }
                  }
                }
              }
              if (n != 0) {
                continue;
              }
              if (e((d)localObject4) == 0)
              {
                if (n == 0) {
                  if (!h(locald2.f()))
                  {
                    arrayOfBoolean[localObject4.d()] = true;
                    if (n != 0) {
                      continue;
                    }
                    if (!bool) {
                      break label297;
                    }
                  }
                }
                if (n != 0) {
                  continue;
                }
                if (!p(locald2))
                {
                  if (n != 0) {
                    continue;
                  }
                  if (!p((d)localObject4)) {
                    arrayOfBoolean[localObject4.d()] = true;
                  }
                }
              }
            }
            ((m)localObject3).f();
          } while (!bool);
        }
        ((a.c.w)localObject1).f();
      } while (n != 0);
    } while (!bool);
    label297:
    label309:
    label326:
    localObject1 = this.g.b();
    label455:
    label484:
    do
    {
      do
      {
        if (!((a.f.j.o)localObject1).e()) {
          break;
        }
        localObject2 = ((a.f.j.o)localObject1).a();
        localObject3 = null;
        localObject4 = ((a.f.j.n)localObject2).a();
        do
        {
          do
          {
            if (!((m)localObject4).e()) {
              break;
            }
            localObject3 = ((m)localObject4).a();
            if (bool) {
              break label455;
            }
            if (d(((d)localObject3).e()))
            {
              if (n != 0) {
                continue;
              }
              if (!q((d)localObject3)) {
                break;
              }
            }
            else
            {
              if (n != 0) {
                continue;
              }
              if (!d(((d)localObject3).f())) {
                break;
              }
            }
            ((m)localObject4).f();
          } while (!bool);
        } while (n != 0);
        if (((m)localObject4).e())
        {
          if (n != 0) {
            break label484;
          }
          ((m)localObject4).b();
          if (!bool) {}
        }
        else
        {
          ((m)localObject4).h();
        }
        do
        {
          if (((m)localObject4).a() == localObject3) {
            break label606;
          }
          locald1 = ((m)localObject4).a();
          locald2 = this.g.e(locald1);
          if (bool) {
            break;
          }
          if (q(locald1))
          {
            d locald3 = this.g.b(this.g.d(this.g.b(locald2)));
            if (n == 0) {
              if (arrayOfBoolean[locald3.d()] != 0)
              {
                arrayOfBoolean[locald1.d()] = true;
                if (n != 0) {
                  continue;
                }
                if (!bool) {
                  break label594;
                }
              }
            }
            arrayOfBoolean[locald2.d()] = true;
          }
          ((m)localObject4).b();
        } while (!bool);
        ((a.f.j.o)localObject1).f();
      } while (n != 0);
    } while (!bool);
    label594:
    label606:
    return arrayOfBoolean;
  }
  
  public void u()
  {
    int i6 = m;
    boolean bool = l;
    boolean[] arrayOfBoolean = t();
    ArrayList[] arrayOfArrayList = new ArrayList[4];
    do
    {
      for (int n = 0; !bool; n++)
      {
        if (n >= 4) {
          break;
        }
        arrayOfArrayList[n] = new ArrayList();
      }
    } while (i6 != 0);
    a.c.w localw = a().v();
    label63:
    if (localw.e()) {
      break label239;
    }
    e locale;
    label78:
    label114:
    Object localObject1;
    label185:
    Object localObject2;
    label239:
    while (i6 != 0)
    {
      locale = localw.d();
      if (bool) {
        break label367;
      }
      int i1 = 0;
      do
      {
        if (i1 >= 4) {
          break label114;
        }
        arrayOfArrayList[i1].clear();
        i1++;
        if ((i6 == 0) && (bool)) {
          break;
        }
      } while (!bool);
      m localm = locale.n();
      if (i6 != 0) {
        break;
      }
      localObject1 = null;
      for (;;)
      {
        if (!localm.e()) {
          break label185;
        }
        if (i6 != 0) {
          break label78;
        }
        if (bool) {
          break;
        }
        if (e(localm.a()) > 0)
        {
          localObject1 = localm.a();
          break label185;
        }
        localm.f();
      }
      localObject2 = localObject1;
      do
      {
        do
        {
          localObject2 = this.g.d((d)localObject2);
          arrayOfArrayList[i(localObject2).h()].add(localObject2);
        } while (localObject2 != localObject1);
      } while (bool);
      int i3 = 0;
      do
      {
        if (i3 >= 4) {
          break label332;
        }
        int i4 = 0;
        if (bool) {
          break;
        }
        int i5 = 0;
        do
        {
          do
          {
            if (i5 >= arrayOfArrayList[i3].size()) {
              break label319;
            }
            d locald = (d)arrayOfArrayList[i3].get(i5);
            if (bool) {
              break;
            }
            if (arrayOfBoolean[locald.d()] == 0)
            {
              if (i4 > 0) {
                throw new RuntimeException("More than one non Kandinsky edge !");
              }
              i4++;
            }
            i5++;
          } while (!bool);
          i3++;
        } while (i6 != 0);
      } while (!bool);
      localw.f();
      if (i6 != 0) {
        break label63;
      }
      if (!bool) {
        break;
      }
    }
    label319:
    label332:
    localw = a().v();
    label367:
    do
    {
      if (!localw.e()) {
        break;
      }
      locale = localw.d();
      if (i6 == 0)
      {
        if (h(locale))
        {
          int i2 = 0;
          localObject1 = locale.m();
          do
          {
            if (!((m)localObject1).e()) {
              break;
            }
            localObject2 = ((m)localObject1).a();
            if (i6 != 0) {
              break label464;
            }
            if (bool) {
              break label463;
            }
            if (arrayOfBoolean[localObject2.d()] != 0) {
              i2++;
            }
            ((m)localObject1).f();
          } while (!bool);
          if (i6 != 0) {
            continue;
          }
          if (i2 > 1) {
            throw new RuntimeException("Bend: " + locale + " is assigned to two zero-degree angles !");
          }
        }
        localw.f();
      }
    } while (!bool);
    label463:
    label464:
    return;
  }
  
  public void v()
  {
    int n = m;
    a().a(this.i);
    if (n == 0) {
      if (this.h == null) {
        a().a(this.j);
      }
    }
    if ((n != 0) || (this.k)) {
      this.g.i();
    }
  }
  
  public int w()
  {
    int i1 = m;
    boolean bool = l;
    int n = 0;
    m localm = a().w();
    do
    {
      do
      {
        if (!localm.e()) {
          break;
        }
        d locald = localm.a();
        if (i1 == 0)
        {
          if (bool) {
            break label78;
          }
          n += f(locald).length() - 1;
          localm.f();
        }
      } while (!bool);
    } while (i1 != 0);
    label78:
    return n / 2;
  }
  
  public String x()
  {
    int n = m;
    boolean bool = l;
    StringBuffer localStringBuffer = new StringBuffer();
    a.c.w localw = a().v();
    label133:
    label135:
    do
    {
      do
      {
        if (!localw.e()) {
          break label138;
        }
        m localm = localw.d().n();
        do
        {
          if (!localm.e()) {
            break;
          }
          d locald = localm.a();
          localStringBuffer.append(locald + ": " + f(locald) + "\n");
          localm.f();
          if (n != 0) {
            break label135;
          }
          if (bool) {
            break label133;
          }
        } while (!bool);
      } while (n != 0);
      localw.f();
    } while (!bool);
    label138:
    return localStringBuffer.toString();
  }
  
  public String y()
  {
    int n = m;
    boolean bool = l;
    StringBuffer localStringBuffer = new StringBuffer();
    m localm = a().w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (n == 0)
      {
        if (bool) {
          break label101;
        }
        localStringBuffer.append(locald + ": " + e(locald) + "\n");
        localm.f();
      }
    } while (!bool);
    label101:
    return localStringBuffer.toString();
  }
  
  protected a_ m(e parame)
  {
    a_ locala_ = (a_)this.j.get(parame);
    if (m == 0) {
      if (locala_ == null)
      {
        locala_ = z();
        this.j.a(parame, locala_);
      }
    }
    return locala_;
  }
  
  protected a_ z()
  {
    return new a_();
  }
  
  protected b_ r(d paramd)
  {
    b_ localb_ = (b_)this.i.get(paramd);
    if (m == 0) {
      if (localb_ == null)
      {
        localb_ = A();
        this.i.a(paramd, localb_);
      }
    }
    return localb_;
  }
  
  protected b_ A()
  {
    return new b_();
  }
  
  public class b_
    extends cb.a_
  {
    private int e;
    private String i;
    private int j = -2147483648;
    private double k = 1.0D;
    private int l = 0;
    private int m = 0;
    public static int n;
    
    public b_() {}
    
    public void a(int paramInt)
    {
      this.e = paramInt;
    }
    
    public int e()
    {
      return this.e;
    }
    
    public void a(String paramString)
    {
      this.i = paramString;
    }
    
    public String f()
    {
      return this.i;
    }
    
    public int g()
    {
      return this.j;
    }
    
    public void b(int paramInt)
    {
      this.j = paramInt;
    }
    
    public double h()
    {
      return this.k;
    }
    
    public void a(double paramDouble)
    {
      this.k = paramDouble;
    }
  }
  
  public static class a_
  {
    private int a = 0;
    public static int b;
    
    int a()
    {
      return this.a;
    }
    
    void a(int paramInt)
    {
      this.a = paramInt;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.b.f

 * JD-Core Version:    0.7.0.1

 */